package com.huiyi.shopping_cart.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.huiyi.common.annotation.Excel;
import com.huiyi.common.core.domain.BaseEntity;

import java.util.Objects;

/**
 * 购物车对象 shopping_cart
 * 
 * @author ruoyi
 * @date 2024-11-28
 */
public class ShoppingCart extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 购物车id */
    private Long id;

    /** 商品名 */
    @Excel(name = "商品名")
    private String name;

    /** 商品图片 */
    @Excel(name = "商品图片")
    private String image;

    /** 用户id */
    @Excel(name = "用户id")
    private Long userId;

    /** 金额 */
    @Excel(name = "金额")
    private String price;

    /** 数量 */
    @Excel(name = "数量")
    private Long number;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setName(String name) 
    {
        this.name = name;
    }

    public String getName() 
    {
        return name;
    }
    public void setImage(String image) 
    {
        this.image = image;
    }

    public String getImage() 
    {
        return image;
    }
    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }
    public void setPrice(String price) 
    {
        this.price = price;
    }

    public String getPrice() 
    {
        return price;
    }
    public void setNumber(Long number) 
    {
        this.number = number;
    }

    public Long getNumber() 
    {
        return number;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("name", getName())
            .append("image", getImage())
            .append("userId", getUserId())
            .append("price", getPrice())
            .append("number", getNumber())
            .append("createTime", getCreateTime())
            .toString();
    }
        @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ShoppingCart that = (ShoppingCart) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(name, that.name) &&
                Objects.equals(number, that.number) &&
                Objects.equals(price, that.price);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, number, price);
    }
}
